package com.lecing.tpl;

/**
 * Created by liucs on 2018/5/29.
 */
public class MainTpl {
    public static  void main(String[] args){
        String filePath="template/loanOutTpl.xlsx";
        ReadXLSX readXLSX=new ReadXLSX(filePath);
        String[] sheetsNames=readXLSX.getSheetsName();
        int[] idx=readXLSX.getSheetsIndex();
        /**
        for (String st:sheetsNames) {
            System.out.println(st);
        }
         */
        int stnum=readXLSX.getNumberOfSheet();
//        System.out.println(stnum);
        int cols=readXLSX.getNumberOfColumns(0); //获取列数
       // System.out.println(cols);
        int rows=readXLSX.getNumberOfRows(0);
//        System.out.println(rows);
        String[] heads=readXLSX.getSheetHeader(0);
     //   System.out.println(":第0列:"+heads[0]+":第1列:"+heads[1]);

        String[][] sdArr=readXLSX.getSheetData(0);
        /**
        for (int i=0;i<sdArr.length;i++){
            String[] arr=sdArr[i];
         //   System.out.println("第"+i+"行:"+arr[i]);
            for (int j=0;j<arr.length;j++){
            //    System.out.println("第"+j+"列:"+arr[j]);
                if(sdArr[i][j]!=null) {
                   // System.out.println(i + "行" + j + "列数据：" + sdArr[i][j]);
                    if(sdArr[i][j].startsWith("$")){
                        System.out.println("获取TPL变量：" + sdArr[i][j]);
                    }
                }
            }
        }*/
        String v="${inSum}";
        System.out.println("得到key:"+getKeyByVal(v));

    }

    private static String getKeyByVal(String value){
        //${inSum}
        String keystr=value.substring(2,value.length()-1);
        return keystr;
    }
}
